package com.project.web.user.controller.app;

import com.project.common.core.utils.exception.Result;
import com.project.model.core.Admin;
import com.project.service.core.AdminService;
import com.project.web.user.controller.common.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

/**
 * 控制器编码范例
 *
 * @author wyy
 * @date 2019-08-20 19:57
 */
@Api(value = "Demo编码范例", tags = "Demo编码范例")
@RestController("adminUserController")
@RequestMapping("/admin/auth/user")
public class UserController extends BaseController {

    @Resource(name = "adminServiceImpl")
    private AdminService adminService;

    /**
     * 根据手机号查询手机用户
     *
     * @param phone 手机号
     * @return
     */
    @ApiOperation(value = "根据手机号查询手机用户", notes = "根据手机号查询手机用户", httpMethod = "POST")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "phone", value = "手机号", dataType = "String")
    })
    @PostMapping(value = "/getByPhone")
    public Result<Admin> getByPhone(String phone) {
        Admin admin = adminService.getByLoginName(phone);
        return getResult(admin);
    }
}
